import HtmlWebpackPlugin from "html-webpack-plugin";

import { resolve } from "path";

export const createJavascript = () => {
	return new HtmlWebpackPlugin({
		template: resolve(__dirname, "./template/script.ejs"),
		filename: `head/script.php`,
		inject: false, //自定义模板不需要自动注入
		publicPath: "<?= TEMPLATE_URL ?>dist", //拼接php地址
		minify: {
			removeComments: true, //去除html注释
			collapseWhitespace: false, //去除换行
			minifyCSS: true //缩小样式元素和样式属性中css
		}
	});
};

export const createCSS = () => {
	return new HtmlWebpackPlugin({
		template: resolve(__dirname, "./template/css.ejs"),
		filename: `head/css.php`,
		inject: false, //自定义模板不需要自动注入
		publicPath: "<?= TEMPLATE_URL ?>dist", //拼接php地址
		minify: {
			removeComments: true, //去除html注释
			collapseWhitespace: false, //去除换行
			minifyCSS: true //缩小样式元素和样式属性中css
		}
	});
};
